package com.fcscs.cservice.client.main.configuration.iguest;


import com.extjs.gxt.ui.client.event.ButtonEvent;
import com.extjs.gxt.ui.client.event.SelectionListener;
import com.extjs.gxt.ui.client.widget.HorizontalPanel;
import com.extjs.gxt.ui.client.widget.VerticalPanel;
import com.extjs.gxt.ui.client.widget.form.SimpleComboBox;
import com.extjs.gxt.ui.client.widget.form.ComboBox.TriggerAction;
import com.fcscs.core.gwt.common.CoreConstants;
import com.fcscs.core.gwt.common.ui.BaseDialog;
import com.fcscs.core.gwt.common.ui.FcsFields.FormButton;
import com.fcscs.cservice.client.common.CServiceConstants;
//import com.fcscs.cservice.client.main.ui.DialogEvent;
import com.fcscs.cservice.client.main.ui.PrecheckinDialogEvent;

public class PrecheckinDialog extends BaseDialog{
	private static PrecheckinDialog INSTANCE;
	private MyFormPanel myFormPanel2;
	
	public static PrecheckinDialog getInstance() {

		if (null == INSTANCE) {
			INSTANCE = new PrecheckinDialog();
		}
		//INSTANCE.bookHisSearch();
		INSTANCE.setHeading(CServiceConstants.CSERVICE_CONSTANTS.precheckin());
		INSTANCE.setButtons("");
		return INSTANCE;
	}

	private PrecheckinDialog() {
		myFormPanel2 = new MyFormPanel();
		setSize(250, 200);
	}

	public class MyFormPanel  {//replace iGuestUsersModel 
		

		private FormButton okButton;
		private FormButton cancelButton;
		 MyFormPanel() {
			//setHeaderVisible(false);
			VerticalPanel vp1=new VerticalPanel();
			vp1.setBorders(true);
			vp1.setSpacing(5);
			
			HorizontalPanel hp1=new HorizontalPanel();
			hp1.setId("iGuestLoginOptionDialog_left1");
			hp1.setSpacing(5);
			
			final SimpleComboBox<String> cbstatus=new SimpleComboBox<String>();
			//cbusername.setDisplayField("Username");
			cbstatus.setEditable(false);
			cbstatus.setWidth(100);
			
			cbstatus.add("Disabled");
			cbstatus.add("Enabled");
			cbstatus.setTriggerAction(TriggerAction.ALL);
			cbstatus.setSimpleValue("Enabled");
			hp1.add(cbstatus);
			
			
			final SimpleComboBox<String> cblevel=new SimpleComboBox<String>();
			cblevel.setEditable(false);
			cblevel.setWidth(100);
			cblevel.add("All Guest");
			cblevel.add("VIP");
			cblevel.add("VIP Level");
			cblevel.setTriggerAction(TriggerAction.ALL);
			cblevel.setSimpleValue("All Guest");
			
			hp1.add(cblevel);
			
			vp1.add(hp1);
			
			HorizontalPanel hp2=new HorizontalPanel();
			hp2.setStyleAttribute(CServiceConstants.CSS_MARGINTOP, "50px");
			hp2.setSpacing(5);
			
			okButton = new FormButton(CoreConstants.CORE_CONSTANTS.ok());
			okButton.setId("iGuestLoginOptionDialog_okButton_id");
			okButton.setStyleAttribute(CServiceConstants.CSS_MARGINLEFT, "70px");
			okButton.setWidth(60);
			okButton.addSelectionListener(new SelectionListener<ButtonEvent>(){
				@Override
				
				public void componentSelected(ButtonEvent ce) {
					PrecheckinDialogEvent.prefireOkEvent(INSTANCE, new PrecheckinDialogEvent(cbstatus.getSimpleValue(), cblevel.getSimpleValue()));
					PrecheckinDialog.this.hide();
				}
			});
			
			cancelButton = new FormButton(CoreConstants.CORE_CONSTANTS.cancel());
			cancelButton.setId("iGuestLoginOptionDialog_okButton_id");
			cancelButton.setWidth(60);
			cancelButton.addSelectionListener(new SelectionListener<ButtonEvent>(){
				@Override
				public void componentSelected(ButtonEvent ce) {
					PrecheckinDialog.this.hide();
				}
			});
			hp2.add(okButton);
			hp2.add(cancelButton);
			vp1.add(hp2);
			
			add(vp1);
		}

		
	}
	@Override
	public void setFocus() {
		// TODO Auto-generated method stub
		
	}

}